export default {
    state: {
        isCollapse: false,//控制菜单的展开还是收齐
        tabsList: [{
            path: "/",
            name: "home",
            label: "首页",
            icon: "s-home",
            url: "Home/Home"
        }]//面包屑数据
    },

    mutations: {
        // 定义菜单收齐的方法
        collapseMenu(state) {
            state.isCollapse = !state.isCollapse
        },
        //定义面包屑导航栏区域,在Aside侧边栏中点击获取
        selectMenu(state, val) {
            if (val.name !== "home") {
                const result = state.tabsList.findIndex(item => item.name === val.name)
                //如果不存在
                if (result === -1) {
                    state.tabsList.push(val)
                }
            }
        },
        //关闭标签页,删除指定的tag数据
        closeTag(state, item) {
            // console.log(item)
            const index = state.tabsList.findIndex(val => val.name === item.name)
            //位置加个数
            state.tabsList.splice(index, 1)
        }
    }
}